import requests
import config


class LoginApi(object):
    login_body = {
        "mobile": config.ADMIN_ACCOUNT,
        "password": config.ADMIN_PWD
    }

    def __init__(self):
        self.url = config.BASE_URL + '/api/sys/login'

    def login(self, body):
        return requests.post(self.url, json=body)

    def get_token(self):
        return {'Authorization': self.login(self.login_body).json().get('data')}

if __name__ == '__main__':
    print(LoginApi().get_token())
